home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / x / volume13 / contool / patch4.02 < prev    next >
Encoding:
Internet Message Format  |  1991-06-18  |  57.9 KB

  1. Path: uunet!uunet!munnari.oz.au!metro!cluster!swift!sunaus.oz!newstop!exodus!trantor.harris-atd.com
  2. From: chuck@trantor.harris-atd.com (Chuck Musciano)
  3. Newsgroups: comp.sources.x
  4. Subject: v13i055: contool -- replacement for 'cmdtool -C', Patch4, Part02/02
  5. Message-ID: <15394@exodus.Eng.Sun.COM>
  6. Date: 18 Jun 91 06:37:27 GMT
  7. References: <csx-13i054-contool@uunet.UU.NET>
  8. Sender: news@exodus.Eng.Sun.COM
  9. Lines: 1706
  10. Approved: argv@sun.com
  11.  
  12. Submitted-by: Chuck Musciano <chuck@trantor.harris-atd.com>
  13. Posting-number: Volume 13, Issue 55
  14. Archive-name: contool/patch4.02
  15. Patch-To: contool: Volume 10, Issues 34-40, 78 (10/29/90)
  16. Patch-To: contool: Volume 11, Issue 5
  17.  
  18.  
  19.      This is the second part of the patch that brings contool from version
  20. 3.0c to 3.1.  You'll need to obtain, unshar, and apply both patches before
  21. rebuilding contool.
  22.  
  23.      Full up-to-date sources, as well as previous patch files, are available
  24. via FTP from trantor.harris-atd.com in /pub/suntools/contool.
  25.  
  26. Chuck Musciano                ARPA  : chuck@trantor.harris-atd.com
  27. Harris Corporation             Usenet: ...!uunet!x102a!trantor!chuck
  28. PO Box 37, MS 3A/1912            AT&T  : (407) 727-6131
  29. Melbourne, FL 32902            FAX   : (407) 729-3363
  30.  
  31. A good newspaper is never good enough,
  32.     but a lousy newspaper is a joy forever.        -- Garrison Keillor
  33.  
  34. #! /bin/sh
  35. # This is a shell archive.  Remove anything before this line, then unpack
  36. # it by saving it into a file and typing "sh file".  To overwrite existing
  37. # files, type "sh file -c".  You can also feed this as standard input via
  38. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  39. # will see the following message at the end:
  40. #        "End of shell archive."
  41. # Contents:  patch.2
  42. # Wrapped by chuck@pluto on Mon Jun  3 08:11:53 1991
  43. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  44. if test -f 'patch.2' -a "${1}" != "-c" ; then 
  45.   echo shar: Will not clobber existing file \"'patch.2'\"
  46. else
  47. echo shar: Extracting \"'patch.2'\" \(55243 characters\)
  48. sed "s/^X//" >'patch.2' <<'END_OF_FILE'
  49. X*** contool.info.orig    Wed May 29 12:09:21 1991
  50. X--- contool.info    Wed May 29 11:59:50 1991
  51. X***************
  52. X*** 58,63 ****
  53. X--- 58,65 ----
  54. X  
  55. X  If "Flash icon" is selected, contool's icon will flash, alternating between the "Check console" and "Flash" images specified in the contool Properties dialog box.
  56. X  
  57. X+ If "Log message" is selected, contool will write the message to the log file, provided that logging is enabled and occurs after filtering.
  58. X+ 
  59. X  If "Open window" is selected, contool will open to a window (if iconic) and move in front of any obscuring windows.
  60. X  
  61. X  If "Timestamp" is selected, a timestamp will be written to the console before the message text.  Timestamping is further controlled by the timestamp resolution defined in the contool Properties dialog box.
  62. X***************
  63. X*** 196,201 ****
  64. X--- 198,217 ----
  65. X  :stop
  66. X  The End pattern text field contains a regular expression (see ed(1) for more on regular expressions) which will match the last line of a multi-line filter.
  67. X  # 
  68. X+ :filter_timeout
  69. X+ This numeric text field determines how long contool will process a multi-line filter.  If contool does not receive a message matching the specified end pattern before the timeout value, the filter is disabled.  This prevents a filter with an erroneous end pattern from absorbing all subsequent console messages.
  70. X+ 
  71. X+ A timeout value of zero indicates that no timeout will be in effect.
  72. X+ 
  73. X+ This item is only enabled if "Type" is set to "Multi-line filter".
  74. X+ # 
  75. X+ :filter_timeout_units
  76. X+ This numeric text field determines how long contool will process a multi-line filter.  If contool does not receive a message matching the specified end pattern before the timeout value, the filter is disabled.  This prevents a filter with an erroneous end pattern from absorbing all subsequent console messages.
  77. X+ 
  78. X+ A timeout value of zero indicates that no timeout will be in effect.
  79. X+ 
  80. X+ This item is only enabled if "Type" is set to "Multi-line filter".
  81. X+ # 
  82. X  :comment
  83. X  The Comment text field should contain a short description of what the current filter does.  Since some filters can be quite arcane, this description can be helpful to new users.
  84. X  
  85. X***************
  86. X*** 217,222 ****
  87. X--- 233,240 ----
  88. X  
  89. X  If "Flash icon" is selected, contool's icon will flash, alternating between the "Check console" and "Flash" images specified in the contool Properties dialog box.
  90. X  
  91. X+ If "Log message" is selected, contool will write the message to the log file, provided that logging is enabled and occurs after filtering.
  92. X+ 
  93. X  If "Open window" is selected, contool will open to a window (if iconic) and move in front of any obscuring windows.
  94. X  
  95. X  If "Timestamp" is selected, a timestamp will be written to the console before the message text.  Timestamping is further controlled by the timestamp resolution defined in the contool Properties dialog box.
  96. X***************
  97. X*** 241,248 ****
  98. X  :filters_apply
  99. X  The Apply button takes the set of filters displayed in the filter list and makes them the current contool filter set.  Before Apply is pressed, any additions, deletions, or changes made to the filters remain local to the Filters dialog box.
  100. X  
  101. X! Even after pressing Apply, the filter changes are not written to the configuration file.  In roder to make your changes take effect for subsequent invocations of contool, use the Save Configuration dialog box to write them to your configuration file.
  102. X  # 
  103. X  :filters_reset
  104. X  The Reset button discards any changes you have made to the displayed filter set, restoring the filters to match the set currently in use by contool.
  105. X  
  106. X--- 259,272 ----
  107. X  :filters_apply
  108. X  The Apply button takes the set of filters displayed in the filter list and makes them the current contool filter set.  Before Apply is pressed, any additions, deletions, or changes made to the filters remain local to the Filters dialog box.
  109. X  
  110. X! Even after pressing Apply, the filter changes are not written to the configuration file.  In order to make your changes take effect for subsequent invocations of contool, use the Save Configuration dialog box to write them to your configuration file.
  111. X  # 
  112. X+ :filters_apply_and_save
  113. X+ The Apply and Save button takes the set of filters displayed in the filter list and makes them the current contool filter set.  The filters are then saved to the current configuration file, along with the current tool properties.  If you wish to save just the filters or just the tool properties, or wish to save to a different file, you should press the Apply button instead and use the more general purpose Save Configuration dialog box.
  114. X+ 
  115. X+ Before this button is pressed, any additions, deletions, or changes made to the filters remain local to the Filters dialog box.
  116. X+ 
  117. X+ # 
  118. X  :filters_reset
  119. X  The Reset button discards any changes you have made to the displayed filter set, restoring the filters to match the set currently in use by contool.
  120. X  
  121. X***************
  122. X*** 351,358 ****
  123. X  This window allows you to send mail concerning contool to its developer.  You are encouraged to send comments and suggestions in order to make contool a better tool.
  124. X  # 
  125. X  :address
  126. X! This choice item lets you select the address to which your mail will be sent.  If your machine understands Internet-style addresses, you should use the first choice item.  If you are a UUCP-based site, you should use the second item.  If neither address works, use the third item to enter a valid address.
  127. X  # 
  128. X  :other_address
  129. X  This text field is used to enter an e-mail address to which your mail will be sent.  It should only be used if the two default addresses do not work from your site.
  130. X  # 
  131. X--- 375,389 ----
  132. X  This window allows you to send mail concerning contool to its developer.  You are encouraged to send comments and suggestions in order to make contool a better tool.
  133. X  # 
  134. X  :address
  135. X! This menu lets you select the address to which your message will be sent.  You should use the first selection for Internet-style mail, the second selection for Usenet-style mail, and the third selection for unusual addressing.
  136. X! 
  137. X! If you select the third item, a text field will appear, allowing you to enter an appropriate e-mail address.
  138. X  # 
  139. X+ :fixed_address
  140. X+ This menu lets you select the address to which your message will be sent.  You should use the first selection for Internet-style mail, the second selection for Usenet-style mail, and the third selection for unusual addressing.
  141. X+ 
  142. X+ If you select the third item, a text field will appear, allowing you to enter an appropriate e-mail address.
  143. X+ # 
  144. X  :other_address
  145. X  This text field is used to enter an e-mail address to which your mail will be sent.  It should only be used if the two default addresses do not work from your site.
  146. X  # 
  147. X***************
  148. X*** 361,366 ****
  149. X  # 
  150. X  :accept_send
  151. X  Clicking this button will send your mail message to contool's developer.
  152. X- # 
  153. X- :cancel_mail
  154. X- Clicking this button cancels the message you were going to send.
  155. X--- 392,394 ----
  156. X*** contool.c.orig    Wed May 29 12:09:24 1991
  157. X--- contool.c    Wed May 29 09:26:31 1991
  158. X***************
  159. X*** 39,45 ****
  160. X  #include    <xview/icon.h>
  161. X  #include    <xview/panel.h>
  162. X  #include    <xview/textsw.h>
  163. X! #include    <xview/xv_xrect.h>
  164. X  
  165. X  #include    "manifest.h"
  166. X  #include    "contool.h"
  167. X--- 39,45 ----
  168. X  #include    <xview/icon.h>
  169. X  #include    <xview/panel.h>
  170. X  #include    <xview/textsw.h>
  171. X! #include    <xview/notify.h>
  172. X  
  173. X  #include    "manifest.h"
  174. X  #include    "contool.h"
  175. X***************
  176. X*** 56,61 ****
  177. X--- 56,63 ----
  178. X  
  179. X  PUBLIC    Server_image        load_icon();
  180. X  
  181. X+ PRIVATE    Notify_value        blink_proc();
  182. X+ 
  183. X  PRIVATE    short    good_bits[]  = {
  184. X  #include    "icons/default_good.icon"
  185. X                     };
  186. X***************
  187. X*** 89,94 ****
  188. X--- 91,97 ----
  189. X  PRIVATE    int            old_time = 0;
  190. X  PRIVATE    char            *program;
  191. X  PRIVATE    FILE            *slave = NULL;
  192. X+ PRIVATE    int            filter_timeout = 0;
  193. X  
  194. X  PRIVATE    struct    itimerval    timer = {{0, 500000}, {0, 500000}};
  195. X  
  196. X***************
  197. X*** 131,153 ****
  198. X  /************************************************************************/
  199. X  
  200. X  /************************************************************************/
  201. X! EXPORT    acquire_console()
  202. X  
  203. X  {
  204. X!     if (ioctl(fileno(slave), TIOCCONS, NULL) == -1)
  205. X!        abend("%s: could not attach to /dev/console", program);
  206. X  }
  207. X  
  208. X  /************************************************************************/
  209. X! EXPORT    stop_blinking()
  210. X  
  211. X! {    Icon    icon;
  212. X! 
  213. X!     notify_set_itimer_func(contool_base->base, NULL, ITIMER_REAL, NULL, NULL);
  214. X!     icon = (Icon) xv_get(contool_base->base, FRAME_ICON);
  215. X!     xv_set(icon, ICON_IMAGE, good, NULL);
  216. X!     xv_set(contool_base->base, FRAME_ICON, icon, 0);
  217. X!     blinking = FALSE;
  218. X  }
  219. X  
  220. X  /************************************************************************/
  221. X--- 134,154 ----
  222. X  /************************************************************************/
  223. X  
  224. X  /************************************************************************/
  225. X! PRIVATE    stop_blinking()
  226. X  
  227. X  {
  228. X!     if (filter_timeout <= 0)
  229. X!        notify_set_itimer_func(contool_base->base, blink_proc, ITIMER_REAL, NULL, NULL);
  230. X!     change_icon(good, good == default_good_icon);
  231. X!     blinking = FALSE;
  232. X  }
  233. X  
  234. X  /************************************************************************/
  235. X! EXPORT    acquire_console()
  236. X  
  237. X! {
  238. X!     if (ioctl(fileno(slave), TIOCCONS, NULL) == -1)
  239. X!        abend("%s: could not attach to /dev/console", program);
  240. X  }
  241. X  
  242. X  /************************************************************************/
  243. X***************
  244. X*** 157,165 ****
  245. X--- 158,184 ----
  246. X      curr_filter = NULL;
  247. X      xv_set(contool_base->base, FRAME_LEFT_FOOTER, "", NULL);
  248. X      end_command();
  249. X+     filter_timeout = 0;
  250. X+     if (!blinking && beep_count == 0)
  251. X+        notify_set_itimer_func(contool_base->base, blink_proc, ITIMER_REAL, NULL, NULL);
  252. X  }
  253. X  
  254. X  /************************************************************************/
  255. X+ EXPORT    adjust_window_limit()
  256. X+ 
  257. X+ {    int    sw_len;
  258. X+     char    *temp;
  259. X+ 
  260. X+     sw_len = (int) xv_get(contool_base->display, TEXTSW_LENGTH);
  261. X+     temp = (char *) malloc((unsigned) sw_len);
  262. X+     xv_get(contool_base->display, TEXTSW_CONTENTS, 0, temp, sw_len);
  263. X+     xv_set(contool_base->display, TEXTSW_MEMORY_MAXIMUM, defaults.max_size + defaults.max_size / 10, NULL);
  264. X+     textsw_reset(contool_base->display, 0, 0);
  265. X+     textsw_insert(contool_base->display, temp, sw_len);
  266. X+     free(temp);
  267. X+ }
  268. X+ 
  269. X+ /************************************************************************/
  270. X  /*    Various small features                        */
  271. X  /************************************************************************/
  272. X  
  273. X***************
  274. X*** 364,370 ****
  275. X            change_icon(bad, bad == default_bad_icon);
  276. X         bad_is_up = !bad_is_up;
  277. X         }
  278. X!     if (beep_count == 0 && !blinking)
  279. X         notify_set_itimer_func(contool_base->base, blink_proc, ITIMER_REAL, NULL, NULL);
  280. X      return(NOTIFY_DONE);
  281. X  }
  282. X--- 383,392 ----
  283. X            change_icon(bad, bad == default_bad_icon);
  284. X         bad_is_up = !bad_is_up;
  285. X         }
  286. X!     if (filter_timeout > 0)
  287. X!        if (--filter_timeout <= 0)
  288. X!           filters_changed();
  289. X!     if (beep_count == 0 && !blinking && filter_timeout <= 0)
  290. X         notify_set_itimer_func(contool_base->base, blink_proc, ITIMER_REAL, NULL, NULL);
  291. X      return(NOTIFY_DONE);
  292. X  }
  293. X***************
  294. X*** 379,389 ****
  295. X  
  296. X  {
  297. X      event_in_progress = TRUE;
  298. X!     if (event_action(event) == ACTION_OPEN && blinking) {
  299. X!        notify_set_itimer_func(contool_base->base, blink_proc, ITIMER_REAL, NULL, NULL);
  300. X!        change_icon(good, good == default_good_icon);
  301. X!        blinking = FALSE;
  302. X!        }
  303. X      event_in_progress = FALSE;
  304. X      return(notify_next_event_func(frame, event, arg, type));
  305. X  }
  306. X--- 401,408 ----
  307. X  
  308. X  {
  309. X      event_in_progress = TRUE;
  310. X!     if (event_action(event) == ACTION_OPEN && blinking)
  311. X!        stop_blinking();
  312. X      event_in_progress = FALSE;
  313. X      return(notify_next_event_func(frame, event, arg, type));
  314. X  }
  315. X***************
  316. X*** 404,409 ****
  317. X--- 423,443 ----
  318. X  }
  319. X  
  320. X  /************************************************************************/
  321. X+ PRIVATE    Notify_value    signal_proc(frame, sig, when)
  322. X+ 
  323. X+ Frame    frame;
  324. X+ int    sig;
  325. X+ Notify_signal_mode    when;
  326. X+ 
  327. X+ {
  328. X+     if (sig == SIGUSR1)
  329. X+        stop_blinking();
  330. X+     else if (sig == SIGHUP)
  331. X+        update_logging();
  332. X+     return(NOTIFY_DONE);
  333. X+ }
  334. X+ 
  335. X+ /************************************************************************/
  336. X  /*    Routines which handle capturing and displaying messages        */
  337. X  /************************************************************************/
  338. X  
  339. X***************
  340. X*** 417,433 ****
  341. X      char    *temp;
  342. X  
  343. X      while ((int) xv_get(contool_base->display, TEXTSW_LENGTH) + len > defaults.max_size) {
  344. X         first = 1;
  345. X         last = TEXTSW_INFINITY;
  346. X         if (textsw_find_bytes(contool_base->display, &first, &last, "\n<<<", 4, 0) == -1)
  347. X            if (textsw_find_bytes(contool_base->display, &first, &last, "\n", 1, 0) == -1)
  348. X!              first = defaults.delete_amount;
  349. X!        textsw_erase(contool_base->display, 0, first + 1);
  350. X!        sw_len = (int) xv_get(contool_base->display, TEXTSW_LENGTH);
  351. X         temp = (char *) malloc((unsigned) sw_len);
  352. X         xv_get(contool_base->display, TEXTSW_CONTENTS, 0, temp, sw_len);
  353. X         textsw_reset(contool_base->display, 0, 0);
  354. X!        textsw_insert(contool_base->display, temp, sw_len);
  355. X         free(temp);
  356. X         }
  357. X      xv_set(contool_base->display, TEXTSW_INSERTION_POINT, TEXTSW_INFINITY, 0);
  358. X--- 451,466 ----
  359. X      char    *temp;
  360. X  
  361. X      while ((int) xv_get(contool_base->display, TEXTSW_LENGTH) + len > defaults.max_size) {
  362. X+        sw_len = (int) xv_get(contool_base->display, TEXTSW_LENGTH);
  363. X         first = 1;
  364. X         last = TEXTSW_INFINITY;
  365. X         if (textsw_find_bytes(contool_base->display, &first, &last, "\n<<<", 4, 0) == -1)
  366. X            if (textsw_find_bytes(contool_base->display, &first, &last, "\n", 1, 0) == -1)
  367. X!              first = (defaults.delete_amount < sw_len)? defaults.delete_amount : sw_len;
  368. X         temp = (char *) malloc((unsigned) sw_len);
  369. X         xv_get(contool_base->display, TEXTSW_CONTENTS, 0, temp, sw_len);
  370. X         textsw_reset(contool_base->display, 0, 0);
  371. X!        textsw_insert(contool_base->display, temp + first, sw_len - first);
  372. X         free(temp);
  373. X         }
  374. X      xv_set(contool_base->display, TEXTSW_INSERTION_POINT, TEXTSW_INFINITY, 0);
  375. X***************
  376. X*** 501,511 ****
  377. X                           if (f->stop == NULL)
  378. X                              end_command();
  379. X                           }
  380. X!                       if (defaults.log_after)
  381. X                   write_log(t);
  382. X                        }
  383. X                     if (f->stop) {
  384. X                        curr_filter = f;
  385. X                        sprintf(buf, "Filtering \"%s\"...", f->start);
  386. X                        xv_set(contool_base->base, FRAME_LEFT_FOOTER, buf, NULL);
  387. X                        }
  388. X--- 534,545 ----
  389. X                           if (f->stop == NULL)
  390. X                              end_command();
  391. X                           }
  392. X!                       if (defaults.log_after && f->log)
  393. X                   write_log(t);
  394. X                        }
  395. X                     if (f->stop) {
  396. X                        curr_filter = f;
  397. X+                       filter_timeout = f->timeout * 2;
  398. X                        sprintf(buf, "Filtering \"%s\"...", f->start);
  399. X                        xv_set(contool_base->base, FRAME_LEFT_FOOTER, buf, NULL);
  400. X                        }
  401. X***************
  402. X*** 519,525 ****
  403. X                     continue_command(t);
  404. X                     end_command();
  405. X                     }
  406. X!             if (defaults.log_after)
  407. X                     write_log(t);
  408. X                  do_insertion(t, strlen(t));
  409. X                  update_value(do_blink, defaults.flash);
  410. X--- 553,559 ----
  411. X                     continue_command(t);
  412. X                     end_command();
  413. X                     }
  414. X!             if (defaults.log_after && defaults.log)
  415. X                     write_log(t);
  416. X                  do_insertion(t, strlen(t));
  417. X                  update_value(do_blink, defaults.flash);
  418. X***************
  419. X*** 531,537 ****
  420. X               if (curr_filter->save) {
  421. X                  if (curr_filter->stamp)
  422. X                     time_stamp();
  423. X!             if (defaults.log_after)
  424. X                     write_log(t);
  425. X              do_insertion(t, strlen(t));
  426. X              if (curr_filter->command)
  427. X--- 565,571 ----
  428. X               if (curr_filter->save) {
  429. X                  if (curr_filter->stamp)
  430. X                     time_stamp();
  431. X!             if (defaults.log_after && curr_filter->log)
  432. X                     write_log(t);
  433. X              do_insertion(t, strlen(t));
  434. X              if (curr_filter->command)
  435. X***************
  436. X*** 557,563 ****
  437. X            bad_is_up = TRUE;
  438. X            notify_set_itimer_func(contool_base->base, blink_proc, ITIMER_REAL, &timer, NULL);
  439. X            }
  440. X!     if (beep_count > 0 || blinking)
  441. X         notify_set_itimer_func(contool_base->base, blink_proc, ITIMER_REAL, &timer, NULL);
  442. X      return(NOTIFY_DONE);
  443. X  }
  444. X--- 591,597 ----
  445. X            bad_is_up = TRUE;
  446. X            notify_set_itimer_func(contool_base->base, blink_proc, ITIMER_REAL, &timer, NULL);
  447. X            }
  448. X!     if (beep_count > 0 || blinking || filter_timeout > 0)
  449. X         notify_set_itimer_func(contool_base->base, blink_proc, ITIMER_REAL, &timer, NULL);
  450. X      return(NOTIFY_DONE);
  451. X  }
  452. X***************
  453. X*** 604,609 ****
  454. X--- 638,644 ----
  455. X            defaults.log_file = log_file;
  456. X         if (log)
  457. X            enable_logging();
  458. X+        adjust_window_limit();
  459. X         }
  460. X      else if (explicit_filters)
  461. X         error("Could not read configuration file %s", filter_file);
  462. X***************
  463. X*** 664,670 ****
  464. X  
  465. X      hints.res_class = "Contool";
  466. X      hints.res_name = (p = rindex(program, '/'))? p + 1 : program;
  467. X!     XSetClassHint(xv_get(contool_base->base, XV_DISPLAY), xv_get(xv_get(contool_base->base, XV_ROOT), XV_XID), &hints);
  468. X  
  469. X      parse_options(&argc, argv);
  470. X      load_filters();
  471. X--- 699,705 ----
  472. X  
  473. X      hints.res_class = "Contool";
  474. X      hints.res_name = (p = rindex(program, '/'))? p + 1 : program;
  475. X!     XSetClassHint(xv_get(contool_base->base, XV_DISPLAY), xv_get(contool_base->base, XV_XID), &hints);
  476. X  
  477. X      parse_options(&argc, argv);
  478. X      load_filters();
  479. X***************
  480. X*** 675,680 ****
  481. X--- 710,717 ----
  482. X      notify_set_input_func(contool_base->base, input_func, fileno(master));
  483. X      notify_interpose_destroy_func(contool_base->base, destroy_proc);
  484. X      notify_interpose_event_func(contool_base->base, close_proc, NOTIFY_SAFE);
  485. X+     notify_set_signal_func(contool_base->base, signal_proc, SIGUSR1, NOTIFY_SYNC);
  486. X+     notify_set_signal_func(contool_base->base, signal_proc, SIGHUP, NOTIFY_SYNC);
  487. X  
  488. X      xv_main_loop(contool_base->base);
  489. X      exit(0);
  490. X*** contool.h.orig    Wed May 29 12:09:25 1991
  491. X--- contool.h    Wed May 29 08:13:12 1991
  492. X***************
  493. X*** 28,35 ****
  494. X  #define        BEEP_BIT        0x01
  495. X  #define        COMMAND_BIT        0x02
  496. X  #define        FLASH_BIT        0x04
  497. X! #define        OPEN_BIT        0x08
  498. X! #define        STAMP_BIT        0x10
  499. X  
  500. X  typedef    struct    filter    Filter;
  501. X  typedef    struct    props    Props;
  502. X--- 28,36 ----
  503. X  #define        BEEP_BIT        0x01
  504. X  #define        COMMAND_BIT        0x02
  505. X  #define        FLASH_BIT        0x04
  506. X! #define        LOG_BIT            0x08
  507. X! #define        OPEN_BIT        0x10
  508. X! #define        STAMP_BIT        0x20
  509. X  
  510. X  typedef    struct    filter    Filter;
  511. X  typedef    struct    props    Props;
  512. X***************
  513. X*** 44,51 ****
  514. X--- 45,54 ----
  515. X           int    save;
  516. X           int    beep;
  517. X           int    flash;
  518. X+          int    log;
  519. X           int    open;
  520. X           int    stamp;
  521. X+          int    timeout;
  522. X           char    *command;
  523. X           Filter    *next;
  524. X          };
  525. X***************
  526. X*** 52,57 ****
  527. X--- 55,61 ----
  528. X  
  529. X  struct    props    {int    beep;
  530. X           int    flash;
  531. X+          int    log;
  532. X           int    open;
  533. X           int    stamp;
  534. X           char    *command;
  535. X***************
  536. X*** 75,77 ****
  537. X--- 79,82 ----
  538. X  PUBLIC    Filter    *filters;
  539. X  PUBLIC    int    parse_errors_occured;
  540. X  PUBLIC    char    *filter_file;
  541. X+ PUBLIC    int    filter_version;
  542. X*** contool_ui.h.orig    Wed May 29 12:09:29 1991
  543. X--- contool_ui.h    Wed May 29 11:59:48 1991
  544. X***************
  545. X*** 15,20 ****
  546. X--- 15,21 ----
  547. X  extern Xv_opaque    contool_filter_insert_menu_create();
  548. X  extern Xv_opaque    contool_filter_edit_menu_create();
  549. X  extern Xv_opaque    contool_filter_paste_menu_create();
  550. X+ extern Xv_opaque    contool_address_menu_create();
  551. X  
  552. X  typedef struct {
  553. X      Xv_opaque    base;
  554. X***************
  555. X*** 90,95 ****
  556. X--- 91,98 ----
  557. X      Xv_opaque    filter_type;
  558. X      Xv_opaque    start;
  559. X      Xv_opaque    stop;
  560. X+     Xv_opaque    filter_timeout;
  561. X+     Xv_opaque    filter_timeout_units;
  562. X      Xv_opaque    comment;
  563. X      Xv_opaque    ignore;
  564. X      Xv_opaque    action;
  565. X***************
  566. X*** 97,102 ****
  567. X--- 100,106 ----
  568. X      Xv_opaque    filter_beep_times;
  569. X      Xv_opaque    filter_command;
  570. X      Xv_opaque    filters_apply;
  571. X+     Xv_opaque    filters_apply_and_save;
  572. X      Xv_opaque    filters_reset;
  573. X  } contool_filters_objects;
  574. X  
  575. X***************
  576. X*** 111,116 ****
  577. X--- 115,122 ----
  578. X  extern Xv_opaque    contool_filters_filter_type_create();
  579. X  extern Xv_opaque    contool_filters_start_create();
  580. X  extern Xv_opaque    contool_filters_stop_create();
  581. X+ extern Xv_opaque    contool_filters_filter_timeout_create();
  582. X+ extern Xv_opaque    contool_filters_filter_timeout_units_create();
  583. X  extern Xv_opaque    contool_filters_comment_create();
  584. X  extern Xv_opaque    contool_filters_ignore_create();
  585. X  extern Xv_opaque    contool_filters_action_create();
  586. X***************
  587. X*** 118,123 ****
  588. X--- 124,130 ----
  589. X  extern Xv_opaque    contool_filters_filter_beep_times_create();
  590. X  extern Xv_opaque    contool_filters_filter_command_create();
  591. X  extern Xv_opaque    contool_filters_filters_apply_create();
  592. X+ extern Xv_opaque    contool_filters_filters_apply_and_save_create();
  593. X  extern Xv_opaque    contool_filters_filters_reset_create();
  594. X  
  595. X  typedef struct {
  596. X***************
  597. X*** 204,214 ****
  598. X      Xv_opaque    message21;
  599. X      Xv_opaque    message22;
  600. X      Xv_opaque    address;
  601. X      Xv_opaque    other_address;
  602. X      Xv_opaque    message;
  603. X      Xv_opaque    mail_controls1;
  604. X      Xv_opaque    accept_send;
  605. X-     Xv_opaque    cancel_mail;
  606. X  } contool_mail_objects;
  607. X  
  608. X  extern contool_mail_objects    *contool_mail_objects_initialize();
  609. X--- 211,221 ----
  610. X      Xv_opaque    message21;
  611. X      Xv_opaque    message22;
  612. X      Xv_opaque    address;
  613. X+     Xv_opaque    fixed_address;
  614. X      Xv_opaque    other_address;
  615. X      Xv_opaque    message;
  616. X      Xv_opaque    mail_controls1;
  617. X      Xv_opaque    accept_send;
  618. X  } contool_mail_objects;
  619. X  
  620. X  extern contool_mail_objects    *contool_mail_objects_initialize();
  621. X***************
  622. X*** 218,226 ****
  623. X  extern Xv_opaque    contool_mail_message21_create();
  624. X  extern Xv_opaque    contool_mail_message22_create();
  625. X  extern Xv_opaque    contool_mail_address_create();
  626. X  extern Xv_opaque    contool_mail_other_address_create();
  627. X  extern Xv_opaque    contool_mail_message_create();
  628. X  extern Xv_opaque    contool_mail_mail_controls1_create();
  629. X  extern Xv_opaque    contool_mail_accept_send_create();
  630. X- extern Xv_opaque    contool_mail_cancel_mail_create();
  631. X  #endif
  632. X--- 225,233 ----
  633. X  extern Xv_opaque    contool_mail_message21_create();
  634. X  extern Xv_opaque    contool_mail_message22_create();
  635. X  extern Xv_opaque    contool_mail_address_create();
  636. X+ extern Xv_opaque    contool_mail_fixed_address_create();
  637. X  extern Xv_opaque    contool_mail_other_address_create();
  638. X  extern Xv_opaque    contool_mail_message_create();
  639. X  extern Xv_opaque    contool_mail_mail_controls1_create();
  640. X  extern Xv_opaque    contool_mail_accept_send_create();
  641. X  #endif
  642. X*** filters.c.orig    Wed May 29 12:09:32 1991
  643. X--- filters.c    Wed May 29 08:13:11 1991
  644. X***************
  645. X*** 161,166 ****
  646. X--- 161,168 ----
  647. X         xv_set(contool_filters->filter_type, PANEL_INACTIVE, FALSE, PANEL_VALUE, f->stop? 1 : 0, NULL);
  648. X         xv_set(contool_filters->start, PANEL_INACTIVE, FALSE, PANEL_VALUE, is_null(f->start), NULL);
  649. X         xv_set(contool_filters->stop, PANEL_INACTIVE, f->stop == NULL, PANEL_VALUE, is_null(f->stop), NULL);
  650. X+        xv_set(contool_filters->filter_timeout, PANEL_INACTIVE, f->stop == NULL, PANEL_VALUE, f->timeout, NULL);
  651. X+        xv_set(contool_filters->filter_timeout_units, PANEL_INACTIVE, f->stop == NULL, NULL);
  652. X         xv_set(contool_filters->comment, PANEL_INACTIVE, FALSE, PANEL_VALUE, is_null(f->comment), NULL);
  653. X         xv_set(contool_filters->ignore, PANEL_INACTIVE, FALSE, PANEL_VALUE, f->save? 0 : 1, NULL);
  654. X         if (f->save) {
  655. X***************
  656. X*** 183,188 ****
  657. X--- 185,192 ----
  658. X               xv_set(contool_filters->filter_command, PANEL_INACTIVE, TRUE, NULL);
  659. X            if (f->flash)
  660. X               i |= FLASH_BIT;
  661. X+           if (f->log)
  662. X+              i |= LOG_BIT;
  663. X            if (f->open)
  664. X               i |= OPEN_BIT;
  665. X            if (f->stamp)
  666. X***************
  667. X*** 197,212 ****
  668. X            }
  669. X         }
  670. X      else {
  671. X!        xv_set(contool_filters->filter_update,     PANEL_INACTIVE, TRUE, NULL);
  672. X!        xv_set(contool_filters->filter_type,       PANEL_INACTIVE, TRUE, NULL);
  673. X!        xv_set(contool_filters->start,             PANEL_INACTIVE, TRUE, NULL);
  674. X!        xv_set(contool_filters->stop,              PANEL_INACTIVE, TRUE, NULL);
  675. X!        xv_set(contool_filters->comment,           PANEL_INACTIVE, TRUE, NULL);
  676. X!        xv_set(contool_filters->ignore,            PANEL_INACTIVE, TRUE, NULL);
  677. X!        xv_set(contool_filters->action,            PANEL_INACTIVE, TRUE, NULL);
  678. X!        xv_set(contool_filters->filter_beep_count, PANEL_INACTIVE, TRUE, NULL);
  679. X!        xv_set(contool_filters->filter_beep_times, PANEL_INACTIVE, TRUE, NULL);
  680. X!        xv_set(contool_filters->filter_command,    PANEL_INACTIVE, TRUE, NULL);
  681. X         }
  682. X  }
  683. X  
  684. X--- 201,218 ----
  685. X            }
  686. X         }
  687. X      else {
  688. X!        xv_set(contool_filters->filter_update,        PANEL_INACTIVE, TRUE, NULL);
  689. X!        xv_set(contool_filters->filter_type,          PANEL_INACTIVE, TRUE, NULL);
  690. X!        xv_set(contool_filters->filter_timeout,       PANEL_INACTIVE, TRUE, NULL);
  691. X!        xv_set(contool_filters->filter_timeout_units, PANEL_INACTIVE, TRUE, NULL);
  692. X!        xv_set(contool_filters->start,                PANEL_INACTIVE, TRUE, NULL);
  693. X!        xv_set(contool_filters->stop,                 PANEL_INACTIVE, TRUE, NULL);
  694. X!        xv_set(contool_filters->comment,              PANEL_INACTIVE, TRUE, NULL);
  695. X!        xv_set(contool_filters->ignore,               PANEL_INACTIVE, TRUE, NULL);
  696. X!        xv_set(contool_filters->action,               PANEL_INACTIVE, TRUE, NULL);
  697. X!        xv_set(contool_filters->filter_beep_count,    PANEL_INACTIVE, TRUE, NULL);
  698. X!        xv_set(contool_filters->filter_beep_times,    PANEL_INACTIVE, TRUE, NULL);
  699. X!        xv_set(contool_filters->filter_command,       PANEL_INACTIVE, TRUE, NULL);
  700. X         }
  701. X  }
  702. X  
  703. X***************
  704. X*** 263,270 ****
  705. X--- 269,278 ----
  706. X      f->beep = defaults.beep;
  707. X      f->command = strsave(defaults.command);
  708. X      f->flash = defaults.flash;
  709. X+     f->log = defaults.log;
  710. X      f->open = defaults.open;
  711. X      f->stamp = defaults.stamp;
  712. X+     f->timeout = 0;
  713. X      f->save = TRUE;
  714. X      update_controls();
  715. X  /* update the scrolling view */
  716. X***************
  717. X*** 315,322 ****
  718. X            error("You must specify a starting message pattern");
  719. X         return(FALSE);
  720. X         }
  721. X!     if (xv_get(contool_filters->filter_type, PANEL_VALUE) == 1)
  722. X         stop = (char *) xv_get(contool_filters->stop, PANEL_VALUE);
  723. X      else
  724. X         stop = NULL;
  725. X      if (msg = compile_exp(f, start, stop)) {
  726. X--- 323,336 ----
  727. X            error("You must specify a starting message pattern");
  728. X         return(FALSE);
  729. X         }
  730. X!     if (xv_get(contool_filters->filter_type, PANEL_VALUE) == 1) {
  731. X         stop = (char *) xv_get(contool_filters->stop, PANEL_VALUE);
  732. X+        if (is_empty(stop)) {
  733. X+           if (flag)
  734. X+              error("You must specify an ending message pattern");
  735. X+           return(FALSE);
  736. X+           }
  737. X+        }
  738. X      else
  739. X         stop = NULL;
  740. X      if (msg = compile_exp(f, start, stop)) {
  741. X***************
  742. X*** 341,346 ****
  743. X--- 355,361 ----
  744. X         else
  745. X            f->beep = 0;
  746. X         f->flash = (i & FLASH_BIT)? TRUE : FALSE;
  747. X+        f->log = (i & LOG_BIT)? TRUE : FALSE;
  748. X         f->open = (i & OPEN_BIT)? TRUE : FALSE;
  749. X         f->stamp = (i & STAMP_BIT)? TRUE : FALSE;
  750. X         f->save = TRUE;
  751. X***************
  752. X*** 347,352 ****
  753. X--- 362,368 ----
  754. X         }
  755. X      else
  756. X         f->save = FALSE;
  757. X+     f->timeout = (stop == NULL)? 0 : (int) xv_get(contool_filters->filter_timeout, PANEL_VALUE);
  758. X      f->start = strsave(start);
  759. X      f->stop = strsave(stop);
  760. X      f->comment = strsave((char *) xv_get(contool_filters->comment, PANEL_VALUE));
  761. X***************
  762. X*** 713,718 ****
  763. X--- 729,736 ----
  764. X  
  765. X  {
  766. X      xv_set(contool_filters->stop, PANEL_INACTIVE, value == 0, NULL);
  767. X+     xv_set(contool_filters->filter_timeout, PANEL_INACTIVE, value == 0, NULL);
  768. X+     xv_set(contool_filters->filter_timeout_units, PANEL_INACTIVE, value == 0, NULL);
  769. X  }
  770. X  
  771. X  /************************************************************************/
  772. X***************
  773. X*** 787,794 ****
  774. X         diff = TRUE;
  775. X      else if ((f->command != NULL && new.command == NULL) || (f->command == NULL && new.command != NULL))
  776. X         diff = TRUE;
  777. X!     else if (f->save != new.save || f->beep != new.beep || f->flash != new.flash || f->open != new.open || f->stamp != new.stamp)
  778. X         diff = TRUE;
  779. X      else if (f->start && strcmp(f->start, new.start) != 0)
  780. X         diff = TRUE;
  781. X      else if (f->stop && strcmp(f->stop, new.stop) != 0)
  782. X--- 805,814 ----
  783. X         diff = TRUE;
  784. X      else if ((f->command != NULL && new.command == NULL) || (f->command == NULL && new.command != NULL))
  785. X         diff = TRUE;
  786. X!     else if (new.stop && f->timeout != new.timeout)
  787. X         diff = TRUE;
  788. X+     else if (f->save != new.save || f->beep != new.beep || f->flash != new.flash || f->log != new.log || f->open != new.open || f->stamp != new.stamp)
  789. X+        diff = TRUE;
  790. X      else if (f->start && strcmp(f->start, new.start) != 0)
  791. X         diff = TRUE;
  792. X      else if (f->stop && strcmp(f->stop, new.stop) != 0)
  793. X***************
  794. X*** 825,834 ****
  795. X      int    i, total;
  796. X      char    *msg = NULL;
  797. X  
  798. X!     if (!check_for_update()) {
  799. X!        xv_set(item, PANEL_NOTIFY_STATUS, XV_ERROR, NULL);
  800. X         return;
  801. X-        }
  802. X  
  803. X      total = (int) xv_get(contool_filters->filter_list, PANEL_LIST_NROWS);
  804. X      for (i = 0; i < total; i++)
  805. X--- 845,854 ----
  806. X      int    i, total;
  807. X      char    *msg = NULL;
  808. X  
  809. X!     xv_set(item, PANEL_NOTIFY_STATUS, XV_ERROR, NULL);
  810. X! 
  811. X!     if (!check_for_update())
  812. X         return;
  813. X  
  814. X      total = (int) xv_get(contool_filters->filter_list, PANEL_LIST_NROWS);
  815. X      for (i = 0; i < total; i++)
  816. X***************
  817. X*** 839,845 ****
  818. X            xv_set(contool_filters->filter_list, PANEL_LIST_SELECT, i, TRUE, NULL);
  819. X            update_controls();
  820. X            error(msg? msg : "No pattern is specified for the indicated filter");
  821. X-           xv_set(item, PANEL_NOTIFY_STATUS, XV_ERROR, NULL);
  822. X            return;
  823. X            }
  824. X      free_list(filters);
  825. X--- 859,864 ----
  826. X***************
  827. X*** 852,857 ****
  828. X--- 871,890 ----
  829. X         clipboard = NULL;
  830. X         }
  831. X      filters_changed();
  832. X+     xv_set(item, PANEL_NOTIFY_STATUS, XV_OK, NULL);
  833. X+ }
  834. X+ 
  835. X+ /************************************************************************/
  836. X+ EXPORT    void    accept_and_save_filters(item, event)
  837. X+ 
  838. X+ Panel_item    item;
  839. X+ Event        *event;
  840. X+ 
  841. X+ {
  842. X+     accept_filters(item, event);
  843. X+     if (xv_get(item, PANEL_NOTIFY_STATUS) == XV_OK)
  844. X+        if (!store_filters_to_file(filter_file, TRUE, TRUE))
  845. X+           xv_set(item, PANEL_NOTIFY_STATUS, XV_ERROR, NULL);
  846. X  }
  847. X  
  848. X  /************************************************************************/
  849. X*** getopt.c.orig    Wed May 29 12:09:33 1991
  850. X--- getopt.c    Fri May 17 09:10:22 1991
  851. X***************
  852. X*** 0 ****
  853. X--- 1,64 ----
  854. X+ /************************************************************************/
  855. X+ /*    Copyright 1987-1991 by Chuck Musciano and Harris Corporation     */
  856. X+ /*                                    */
  857. X+ /*    Full ownership of this software, and all rights pertaining to     */
  858. X+ /*    the for-profit distribution of this software, are retained by     */
  859. X+ /*    Chuck Musciano and Harris Corporation.  You are permitted to     */
  860. X+ /*    use this software without fee.  This software is provided "as     */
  861. X+ /*    is" without express or implied warranty.  You may redistribute     */
  862. X+ /*    this software, provided that this copyright notice is retained,    */
  863. X+ /*    and that the software is not distributed for profit.  If you     */
  864. X+ /*    wish to use this software in a profit-making venture, you must     */
  865. X+ /*    first license this code and its underlying technology from     */
  866. X+ /*    Harris Corporation.                         */
  867. X+ /*                                    */
  868. X+ /*    Bottom line: you can have this software, you can use it, you     */
  869. X+ /*    can give it away.  You just can't sell any or all parts of it     */
  870. X+ /*    without prior permission from Harris Corporation.         */
  871. X+ /************************************************************************/
  872. X+ 
  873. X+ #include    <stdio.h>
  874. X+ 
  875. X+ #include    "manifest.h"
  876. X+ 
  877. X+ /************************************************************************/
  878. X+ PRIVATE    delarg(argc, argv)
  879. X+ 
  880. X+ int    *argc;
  881. X+ char    **argv;
  882. X+ 
  883. X+ {    char    *p;
  884. X+ 
  885. X+     while (*argv = *(argv+1))
  886. X+        argv++;
  887. X+     (*argc)--;
  888. X+ }
  889. X+ 
  890. X+ /************************************************************************/
  891. X+ EXPORT    char    getopt(argc, argv, opts, parm)
  892. X+ 
  893. X+ int    *argc;
  894. X+ char    **argv;
  895. X+ char    *opts;
  896. X+ char    **parm;
  897. X+ 
  898. X+ {    char    c, *p, *strcpy(), *index();
  899. X+     int    killed;
  900. X+ 
  901. X+     *parm = NULL;
  902. X+     while (*argv && ((**argv != '-') || (*(*argv+1) == '\0')))
  903. X+        argv++;
  904. X+     if (*argv == NULL)
  905. X+        return(EOF);
  906. X+     c = *(*argv+1);
  907. X+     *++(*argv) = '-';
  908. X+     if (killed = (*(*argv+1) == '\0'))
  909. X+        delarg(argc, argv);
  910. X+     if ((p = index(opts, c)) == NULL)
  911. X+        c = '\0';
  912. X+     else if (*(p+1) == ':') {
  913. X+        *parm = killed ? *argv : *argv+1;
  914. X+        delarg(argc, argv);
  915. X+        }
  916. X+     return(c);
  917. X+ }
  918. X*** lex.c.orig    Wed May 29 12:09:34 1991
  919. X--- lex.c    Wed May 29 08:13:11 1991
  920. X***************
  921. X*** 41,46 ****
  922. X--- 41,47 ----
  923. X                   {"flash_icon",           FLASH_ICON},
  924. X                   {"good_icon",            GOOD_ICON},
  925. X                   {"ignore",               IGNORE},
  926. X+                  {"log",                  LOG},
  927. X                   {"log_before_filtering", LOG_BEFORE_FILTERING},
  928. X                   {"log_file",             LOG_FILE},
  929. X                   {"match",                MATCH},
  930. X***************
  931. X*** 53,60 ****
  932. X--- 54,63 ----
  933. X                   {"quiet",                QUIET},
  934. X                   {"save",                 SAVE},
  935. X                   {"stamp",                STAMP},
  936. X+                  {"timeout",              TIMEOUT},
  937. X                   {"timestamp",            TIMESTAMP},
  938. X                   {"to",                   TO},
  939. X+                  {"version",              VERSION},
  940. X                   {"yes",                  YES}};
  941. X  
  942. X  PRIVATE    struct    {char    first;
  943. X***************
  944. X*** 100,121 ****
  945. X  }
  946. X  
  947. X  /************************************************************************/
  948. X- PRIVATE    fix_escapes(buf)
  949. X- 
  950. X- char    *buf;
  951. X- 
  952. X- {    char    *q;
  953. X-     int    i;
  954. X- 
  955. X-     for (q = buf; *buf; buf++, q++)
  956. X-        if (*buf == '\\')
  957. X-           *q = *++buf;
  958. X-        else
  959. X-           *q = *buf;
  960. X-     *q = '\0';
  961. X- }
  962. X- 
  963. X- /************************************************************************/
  964. X  PRIVATE    int    is_keyword(s)
  965. X  
  966. X  char    *s;
  967. X--- 103,108 ----
  968. X***************
  969. X*** 164,179 ****
  970. X         }
  971. X      else if (c == '"' || c == '\'') {
  972. X         for (p = buf; TRUE; p++)
  973. X!           if ((*p = getch()) == c)
  974. X!              break;
  975. X!           else if (*p == '\\')
  976. X!              *++p = getch();
  977. X            else if (*p == '\n' || *p == '\r') {
  978. X               yyerror("Newline in string not allowed");
  979. X               break;
  980. X               }
  981. X         *p = '\0';
  982. X-        fix_escapes(buf);
  983. X         yylval.cpval = strsave(buf);
  984. X         RETURN(STRING);
  985. X         }
  986. X--- 151,169 ----
  987. X         }
  988. X      else if (c == '"' || c == '\'') {
  989. X         for (p = buf; TRUE; p++)
  990. X!           if ((*p = getch()) == c) {
  991. X!              if ((c1 = getch()) != c) {
  992. X!                 ungetc = c1;
  993. X!                 break;
  994. X!                 }
  995. X!              }
  996. X!           else if (*p == '\\' && filter_version < 310)
  997. X!              *p = getch();
  998. X            else if (*p == '\n' || *p == '\r') {
  999. X               yyerror("Newline in string not allowed");
  1000. X               break;
  1001. X               }
  1002. X         *p = '\0';
  1003. X         yylval.cpval = strsave(buf);
  1004. X         RETURN(STRING);
  1005. X         }
  1006. X*** load.c.orig    Wed May 29 12:09:35 1991
  1007. X--- load.c    Tue May 28 14:16:42 1991
  1008. X***************
  1009. X*** 79,86 ****
  1010. X            }
  1011. X         else {
  1012. X            kind = (int) xv_get(ip->load_type, PANEL_VALUE);
  1013. X!           if (kind & 1 && parsed_defaults)
  1014. X               defaults = *parsed_defaults;
  1015. X            if (kind & 2)
  1016. X               filters = parsed_filters;
  1017. X            free(parsed_defaults);
  1018. X--- 79,88 ----
  1019. X            }
  1020. X         else {
  1021. X            kind = (int) xv_get(ip->load_type, PANEL_VALUE);
  1022. X!           if (kind & 1 && parsed_defaults) {
  1023. X               defaults = *parsed_defaults;
  1024. X+              adjust_window_limit();
  1025. X+              }
  1026. X            if (kind & 2)
  1027. X               filters = parsed_filters;
  1028. X            free(parsed_defaults);
  1029. X*** load_icon.c.orig    Wed May 29 12:09:35 1991
  1030. X--- load_icon.c    Thu May 23 11:59:02 1991
  1031. X***************
  1032. X*** 29,35 ****
  1033. X  #define        ICON_PATH        ".:./icons:/usr/local/images:/usr/include/images"
  1034. X  #endif
  1035. X  
  1036. X! PUBLIC    char    *getenv();
  1037. X  
  1038. X  /************************************************************************/
  1039. X  EXPORT    Server_image    load_icon(path, message)
  1040. X--- 29,35 ----
  1041. X  #define        ICON_PATH        ".:./icons:/usr/local/images:/usr/include/images"
  1042. X  #endif
  1043. X  
  1044. X! PUBLIC    char    *getenv(), *index();
  1045. X  
  1046. X  /************************************************************************/
  1047. X  EXPORT    Server_image    load_icon(path, message)
  1048. X*** misc.c.orig    Wed May 29 12:09:37 1991
  1049. X--- misc.c    Fri May 24 13:42:46 1991
  1050. X***************
  1051. X*** 24,29 ****
  1052. X--- 24,31 ----
  1053. X  #include    "manifest.h"
  1054. X  #include    "contool.h"
  1055. X  
  1056. X+ PUBLIC    char    *index();
  1057. X+ 
  1058. X  /************************************************************************/
  1059. X  EXPORT    int    getline(stream, string, max)
  1060. X  
  1061. X***************
  1062. X*** 43,90 ****
  1063. X  }
  1064. X  
  1065. X  /************************************************************************/
  1066. X- PRIVATE    delarg(argc, argv)
  1067. X- 
  1068. X- int    *argc;
  1069. X- char    **argv;
  1070. X- 
  1071. X- {    char    *p;
  1072. X- 
  1073. X-     while (*argv = *(argv+1))
  1074. X-        argv++;
  1075. X-     (*argc)--;
  1076. X- }
  1077. X- 
  1078. X- /************************************************************************/
  1079. X- EXPORT    char    getopt(argc, argv, opts, parm)
  1080. X- 
  1081. X- int    *argc;
  1082. X- char    **argv;
  1083. X- char    *opts;
  1084. X- char    **parm;
  1085. X- 
  1086. X- {    char    c, *p, *strcpy(), *index();
  1087. X-     int    killed;
  1088. X- 
  1089. X-     *parm = NULL;
  1090. X-     while (*argv && ((**argv != '-') || (*(*argv+1) == '\0')))
  1091. X-        argv++;
  1092. X-     if (*argv == NULL)
  1093. X-        return(EOF);
  1094. X-     c = *(*argv+1);
  1095. X-     *++(*argv) = '-';
  1096. X-     if (killed = (*(*argv+1) == '\0'))
  1097. X-        delarg(argc, argv);
  1098. X-     if ((p = index(opts, c)) == NULL)
  1099. X-        c = '\0';
  1100. X-     else if (*(p+1) == ':') {
  1101. X-        *parm = killed ? *argv : *argv+1;
  1102. X-        delarg(argc, argv);
  1103. X-        }
  1104. X-     return(c);
  1105. X- }
  1106. X- 
  1107. X- /************************************************************************/
  1108. X  EXPORT    int    verify(source, valid)
  1109. X  
  1110. X  char    *source;
  1111. X--- 45,50 ----
  1112. X***************
  1113. X*** 256,263 ****
  1114. X      char    *p;
  1115. X  
  1116. X      for (p = buf; *s; s++, p++)
  1117. X!        if (*s == '\\' || *s == '"') {
  1118. X!           *p++ = '\\';
  1119. X            *p = *s;
  1120. X            }
  1121. X         else
  1122. X--- 216,223 ----
  1123. X      char    *p;
  1124. X  
  1125. X      for (p = buf; *s; s++, p++)
  1126. X!        if (*s == '"') {
  1127. X!           *p++ = '"';
  1128. X            *p = *s;
  1129. X            }
  1130. X         else
  1131. X*** parse.y.orig    Wed May 29 12:09:38 1991
  1132. X--- parse.y    Wed May 29 10:10:58 1991
  1133. X***************
  1134. X*** 27,32 ****
  1135. X--- 27,33 ----
  1136. X  
  1137. X  EXPORT    Props    *parsed_defaults;
  1138. X  EXPORT    Filter    *parsed_filters;
  1139. X+ EXPORT    int    filter_version = 0;
  1140. X  
  1141. X  EXPORT    int    parse_errors_occured;
  1142. X  
  1143. X***************
  1144. X*** 53,62 ****
  1145. X  %token        LBRACE RBRACE
  1146. X  
  1147. X  %token        BEEP CHECK_ICON COMMAND COMMENT DEFAULTS DELETE DISPLAY FILTERS
  1148. X!         FLASH FLASH_ICON GOOD_ICON IGNORE LOG_BEFORE_FILTERING LOG_FILE
  1149. X!         MATCH NO NOFLASH NOOPEN NOSTAMP OPEN PRINT QUIET SAVE STAMP TIMESTAMP TO YES
  1150. X  
  1151. X! %type    <ival>    beep flash old_flash old_open old_stamp open stamp yes_no
  1152. X  %type    <cpval>    command old_end_string string
  1153. X  %type    <fval>    filter filter_list old_filter old_filter_list old_ignore old_quiet old_save
  1154. X  
  1155. X--- 54,64 ----
  1156. X  %token        LBRACE RBRACE
  1157. X  
  1158. X  %token        BEEP CHECK_ICON COMMAND COMMENT DEFAULTS DELETE DISPLAY FILTERS
  1159. X!         FLASH FLASH_ICON GOOD_ICON IGNORE LOG LOG_BEFORE_FILTERING LOG_FILE
  1160. X!         MATCH NO NOFLASH NOOPEN NOSTAMP OPEN PRINT QUIET SAVE STAMP TIMEOUT
  1161. X!         TIMESTAMP TO VERSION YES
  1162. X  
  1163. X! %type    <ival>    beep flash log old_flash old_open old_stamp open stamp yes_no
  1164. X  %type    <cpval>    command old_end_string string
  1165. X  %type    <fval>    filter filter_list old_filter old_filter_list old_ignore old_quiet old_save
  1166. X  
  1167. X***************
  1168. X*** 100,105 ****
  1169. X--- 102,109 ----
  1170. X                        f->flash    = $3;
  1171. X                        f->open     = $4;
  1172. X                        f->stamp    = $5;
  1173. X+                       f->timeout  = 0;
  1174. X+                       f->log      = TRUE;
  1175. X                        f->start    = $6;
  1176. X                        f->stop     = $7;
  1177. X                        f->start_re = NULL;
  1178. X***************
  1179. X*** 123,128 ****
  1180. X--- 127,134 ----
  1181. X                        f->flash    = FALSE;
  1182. X                        f->open     = FALSE;
  1183. X                        f->stamp    = FALSE;
  1184. X+                       f->timeout  = 0;
  1185. X+                       f->log      = TRUE;
  1186. X                        f->start    = $2;
  1187. X                        f->stop     = $3;
  1188. X                        f->start_re = NULL;
  1189. X***************
  1190. X*** 146,151 ****
  1191. X--- 152,159 ----
  1192. X                        f->flash    = FALSE;
  1193. X                        f->open     = FALSE;
  1194. X                        f->stamp    = TRUE;
  1195. X+                       f->timeout  = 0;
  1196. X+                       f->log      = TRUE;
  1197. X                        f->start    = $2;
  1198. X                        f->stop     = $3;
  1199. X                        f->start_re = NULL;
  1200. X***************
  1201. X*** 183,193 ****
  1202. X                      { $$ = $2; }
  1203. X          ;
  1204. X  
  1205. X! new_style    :    defaults
  1206. X!         |    filters
  1207. X!         |    defaults filters
  1208. X          ;
  1209. X  
  1210. X  defaults    :    DEFAULTS
  1211. X                      { parsed_defaults = (Props *) malloc(sizeof(Props));
  1212. X                        *parsed_defaults = defaults;
  1213. X--- 191,207 ----
  1214. X                      { $$ = $2; }
  1215. X          ;
  1216. X  
  1217. X! new_style    :    version defaults
  1218. X!         |    version filters
  1219. X!         |    version defaults filters
  1220. X          ;
  1221. X  
  1222. X+ version        :    empty
  1223. X+                     { filter_version = 0; }
  1224. X+         |    VERSION INTEGER
  1225. X+                     { filter_version = $2; }
  1226. X+         ;
  1227. X+ 
  1228. X  defaults    :    DEFAULTS
  1229. X                      { parsed_defaults = (Props *) malloc(sizeof(Props));
  1230. X                        *parsed_defaults = defaults;
  1231. X***************
  1232. X*** 209,214 ****
  1233. X--- 223,230 ----
  1234. X                      { parsed_defaults->command = $1; }
  1235. X          |    flash
  1236. X                      { parsed_defaults->flash = $1; }
  1237. X+         |    log
  1238. X+                     { parsed_defaults->log = $1; }
  1239. X          |    open
  1240. X                      { parsed_defaults->open = $1; }
  1241. X          |    stamp
  1242. X***************
  1243. X*** 252,257 ****
  1244. X--- 268,275 ----
  1245. X  filter        :    LBRACE
  1246. X                      { curr = (Filter *) malloc(sizeof(Filter));
  1247. X                        bzero(curr, sizeof(Filter));
  1248. X+                       if (filter_version < 310)
  1249. X+                          curr->log = TRUE;
  1250. X                      }
  1251. X              filter_attr_list RBRACE
  1252. X                      { char    *msg;
  1253. X***************
  1254. X*** 274,279 ****
  1255. X--- 292,299 ----
  1256. X                      { curr->command = $1; }
  1257. X          |    flash
  1258. X                      { curr->flash = $1; }
  1259. X+         |    log
  1260. X+                     { curr->log = $1; }
  1261. X          |    open
  1262. X                      { curr->open = $1; }
  1263. X          |    stamp
  1264. X***************
  1265. X*** 284,289 ****
  1266. X--- 304,311 ----
  1267. X                      { curr->save = !$2; }
  1268. X          |    MATCH string
  1269. X                      { curr->start = $2; }
  1270. X+         |    TIMEOUT INTEGER
  1271. X+                     { curr->timeout = $2; }
  1272. X          |    TO string
  1273. X                      { curr->stop = $2; }
  1274. X          ;
  1275. X***************
  1276. X*** 296,301 ****
  1277. X--- 318,327 ----
  1278. X                      { $$ = $2; }
  1279. X          ;
  1280. X  flash        :    FLASH yes_no
  1281. X+                     { $$ = $2; }
  1282. X+         ;
  1283. X+ 
  1284. X+ log        :    LOG yes_no
  1285. X                      { $$ = $2; }
  1286. X          ;
  1287. X  
  1288. X*** patchlevel.h.orig    Wed May 29 12:09:39 1991
  1289. X--- patchlevel.h    Tue May 28 13:27:17 1991
  1290. X***************
  1291. X*** 30,34 ****
  1292. X--- 30,37 ----
  1293. X  /*               comp.sources.x: Volume 10, Issue 78        */
  1294. X  /*                                    */
  1295. X  /*      3        Bug fixes; see README for details        */
  1296. X+ /*               comp.sources.x: Volume 11, Issue 4        */
  1297. X+ /*                                    */
  1298. X+ /*      4        Release of version 3.1; see README for details    */
  1299. X  /*                                    */
  1300. X  /************************************************************************/
  1301. X*** props.c.orig    Wed May 29 12:09:41 1991
  1302. X--- props.c    Tue May 28 14:16:40 1991
  1303. X***************
  1304. X*** 37,42 ****
  1305. X--- 37,43 ----
  1306. X  
  1307. X  EXPORT    Props    defaults = {3,        /* beeps             */
  1308. X                  TRUE,    /* flash the icon         */
  1309. X+                 TRUE,    /* write the message to the log     */
  1310. X                  FALSE,    /* don't pop the window         */
  1311. X                  TRUE,    /* timestamp the message     */
  1312. X                  NULL,    /* no command to run         */
  1313. X***************
  1314. X*** 67,72 ****
  1315. X--- 68,75 ----
  1316. X         val |= COMMAND_BIT;
  1317. X      if (defaults.flash)
  1318. X         val |= FLASH_BIT;
  1319. X+     if (defaults.log)
  1320. X+        val |= LOG_BIT;
  1321. X      if (defaults.open)
  1322. X         val |= OPEN_BIT;
  1323. X      if (defaults.stamp > 0)
  1324. X***************
  1325. X*** 170,175 ****
  1326. X--- 173,179 ----
  1327. X         new.command = NULL;
  1328. X  
  1329. X      new.flash            = (val & FLASH_BIT)? TRUE : FALSE;
  1330. X+     new.log              = (val & LOG_BIT)? TRUE : FALSE;
  1331. X      new.open             = (val & OPEN_BIT)? TRUE : FALSE;
  1332. X      new.stamp            = (val & STAMP_BIT)? TRUE : FALSE;
  1333. X      new.log_file         = (char *) xv_get(ip->log_file,         PANEL_VALUE);
  1334. X***************
  1335. X*** 213,218 ****
  1336. X--- 217,223 ----
  1337. X      new.command = strsave(defaults.command);
  1338. X      defaults = new;
  1339. X  
  1340. X+     adjust_window_limit();
  1341. X      update_icons();
  1342. X      update_logging();
  1343. X  }
  1344. X*** regexp.c.orig    Wed May 29 12:09:42 1991
  1345. X--- regexp.c    Fri May 24 13:42:44 1991
  1346. X***************
  1347. X*** 82,87 ****
  1348. X--- 82,107 ----
  1349. X  }
  1350. X  
  1351. X  /************************************************************************/
  1352. X+ PRIVATE    char    *fix_control_chars(s)
  1353. X+ 
  1354. X+ char    *s;
  1355. X+ 
  1356. X+ {    static    char    buf[2048];
  1357. X+     char    *p;
  1358. X+ 
  1359. X+     for (p = buf; *s; s++, p++)
  1360. X+        if (*s == '\\' && *(s + 1) >= '0' && *(s + 1) <= '7') {
  1361. X+           for (*p = 0, s++; *s && *s >= '0' && *s <= '7'; s++)
  1362. X+              *p = (*p << 3) + *s - '0';
  1363. X+           s--;
  1364. X+           }
  1365. X+        else
  1366. X+           *p = *s;
  1367. X+     *p = '\0';
  1368. X+     return(buf);
  1369. X+ }
  1370. X+ 
  1371. X+ /************************************************************************/
  1372. X  EXPORT    char    *compile_exp(filter, start, stop)
  1373. X  
  1374. X  Filter    *filter;
  1375. X***************
  1376. X*** 93,104 ****
  1377. X  
  1378. X      sre = ere = NULL;
  1379. X      if (start) {
  1380. X!        if ((sre = compile(start, rbuf, rbuf+1024, '\0')) == NULL)
  1381. X            return(error_message);
  1382. X         sc = circf;
  1383. X         }
  1384. X      if (stop) {
  1385. X!        if ((ere = compile(stop, rbuf, rbuf+1024, '\0')) == NULL) {
  1386. X            cond_free(sre);
  1387. X            return(error_message);
  1388. X            }
  1389. X--- 113,124 ----
  1390. X  
  1391. X      sre = ere = NULL;
  1392. X      if (start) {
  1393. X!        if ((sre = compile(fix_control_chars(start), rbuf, rbuf+1024, '\0')) == NULL)
  1394. X            return(error_message);
  1395. X         sc = circf;
  1396. X         }
  1397. X      if (stop) {
  1398. X!        if ((ere = compile(fix_control_chars(stop), rbuf, rbuf+1024, '\0')) == NULL) {
  1399. X            cond_free(sre);
  1400. X            return(error_message);
  1401. X            }
  1402. X*** send_mail.c.orig    Wed May 29 12:09:43 1991
  1403. X--- send_mail.c    Wed May 29 11:59:52 1991
  1404. X***************
  1405. X*** 33,39 ****
  1406. X  
  1407. X  #include    "manifest.h"
  1408. X  
  1409. X! #define        VERSION            "3.0c"
  1410. X  
  1411. X  PUBLIC    contool_base_objects    *contool_base;
  1412. X  
  1413. X--- 33,39 ----
  1414. X  
  1415. X  #include    "manifest.h"
  1416. X  
  1417. X! #define        VERSION            "3.1"
  1418. X  
  1419. X  PUBLIC    contool_base_objects    *contool_base;
  1420. X  
  1421. X***************
  1422. X*** 56,77 ****
  1423. X  }
  1424. X  
  1425. X  /************************************************************************/
  1426. X! EXPORT    void    handle_address(item, value, event)
  1427. X  
  1428. X! Panel_item    item;
  1429. X! int        value;
  1430. X! Event        *event;
  1431. X  
  1432. X! {
  1433. X!     if (value == 2) {
  1434. X!        xv_set(dialog->other_address, WIN_SHOW, TRUE, NULL);
  1435. X!        panel_paint(dialog->address, PANEL_NO_CLEAR);
  1436. X!        panel_paint(dialog->other_address, PANEL_NO_CLEAR);
  1437. X         }
  1438. X!     else {
  1439. X!        xv_set(dialog->other_address, WIN_SHOW, FALSE, NULL);
  1440. X!        panel_paint(dialog->address, PANEL_NO_CLEAR);
  1441. X!        }
  1442. X  }
  1443. X  
  1444. X  /************************************************************************/
  1445. X--- 56,78 ----
  1446. X  }
  1447. X  
  1448. X  /************************************************************************/
  1449. X! EXPORT    Menu    handle_address(menu, op)
  1450. X  
  1451. X! Menu_item    menu;
  1452. X! Menu_generate    op;
  1453. X  
  1454. X! {    char    *addr;
  1455. X! 
  1456. X!     if (op == MENU_NOTIFY) {
  1457. X!        addr = (char *) xv_get(menu, MENU_STRING);
  1458. X!        xv_set(dialog->other_address, WIN_SHOW, strcmp(addr, "Other:") == 0, NULL);
  1459. X!        xv_set(dialog->fixed_address, PANEL_LABEL_STRING, addr, NULL);
  1460. X!        panel_paint(dialog->other_address, PANEL_CLEAR);
  1461. X!        panel_paint(dialog->fixed_address, PANEL_CLEAR);
  1462. X         }
  1463. X!     xv_set(menu, MENU_NOTIFY_STATUS, XV_ERROR, NULL);
  1464. X!     xv_set(xv_get(menu, MENU_PARENT), MENU_NOTIFY_STATUS, XV_ERROR, NULL);
  1465. X!     return(menu);
  1466. X  }
  1467. X  
  1468. X  /************************************************************************/
  1469. X***************
  1470. X*** 95,103 ****
  1471. X      FILE    *pipe;
  1472. X  
  1473. X      xv_set(item, PANEL_NOTIFY_STATUS, XV_ERROR, 0);
  1474. X!     val = (int) xv_get(dialog->address, PANEL_VALUE);
  1475. X!     if (val != 2)
  1476. X!        sprintf(cmd, "%s %s", MAILER, xv_get(dialog->address, PANEL_CHOICE_STRING, val));
  1477. X      else {
  1478. X         buf = (char *) xv_get(dialog->other_address, PANEL_VALUE);
  1479. X         if (is_empty(buf)) {
  1480. X--- 96,104 ----
  1481. X      FILE    *pipe;
  1482. X  
  1483. X      xv_set(item, PANEL_NOTIFY_STATUS, XV_ERROR, 0);
  1484. X!     buf = (char *) xv_get(dialog->fixed_address, PANEL_LABEL_STRING);
  1485. X!     if (strcmp(buf, "Other:") != 0)
  1486. X!        sprintf(cmd, "%s %s", MAILER, buf);
  1487. X      else {
  1488. X         buf = (char *) xv_get(dialog->other_address, PANEL_VALUE);
  1489. X         if (is_empty(buf)) {
  1490. X***************
  1491. X*** 129,144 ****
  1492. X      free(buf);
  1493. X      textsw_reset(dialog->message, 0, 0);
  1494. X      lets_get_busy(contool_base->base, FALSE, NULL);
  1495. X-     xv_set(item, PANEL_NOTIFY_STATUS, XV_OK, 0);
  1496. X- }
  1497. X- 
  1498. X- /************************************************************************/
  1499. X- EXPORT    void    cancel_mail(item, event)
  1500. X- 
  1501. X- Panel_item    item;
  1502. X- Event        *event;
  1503. X- 
  1504. X- {
  1505. X-     textsw_reset(dialog->message, 0, 0);
  1506. X      xv_set(item, PANEL_NOTIFY_STATUS, XV_OK, 0);
  1507. X  }
  1508. X--- 130,134 ----
  1509. X*** store.c.orig    Wed May 29 12:09:43 1991
  1510. X--- store.c    Wed May 29 08:13:10 1991
  1511. X***************
  1512. X*** 39,44 ****
  1513. X--- 39,46 ----
  1514. X  
  1515. X  #define        yes_no(x)        ((x)? "yes" : "no")
  1516. X  
  1517. X+ #define        FILTER_VERSION        310
  1518. X+ 
  1519. X  PUBLIC    contool_base_objects    *contool_base;
  1520. X  
  1521. X  PRIVATE    contool_store_objects    *contool_store = NULL;
  1522. X***************
  1523. X*** 68,147 ****
  1524. X  }
  1525. X  
  1526. X  /************************************************************************/
  1527. X! EXPORT    void    store_filters(item, event)
  1528. X  
  1529. X! Panel_item    item;
  1530. X! Event        *event;
  1531. X  
  1532. X! {    contool_store_objects    *ip = (contool_store_objects *) xv_get(item, XV_KEY_DATA, INSTANCE);
  1533. X!     char    *path, buf[1024];
  1534. X      FILE    *f;
  1535. X-     int    kind;
  1536. X      Filter    *filt;
  1537. X  
  1538. X-     path = expand_tilde(xv_get(ip->store_file, PANEL_VALUE));
  1539. X      if (access(path, W_OK) == 0) {
  1540. X         sprintf(buf, "File \"%s\" exists.  You can:", path);
  1541. X!        kind = notice_prompt(contool_base->base, NULL,
  1542. X!                       NOTICE_MESSAGE_STRINGS, buf, NULL,
  1543. X!                       NOTICE_BUTTON_YES, "Overwrite",
  1544. X!                       NOTICE_BUTTON_NO, "Cancel",
  1545. X!                    NULL);
  1546. X!        if (kind == 0) {
  1547. X!           xv_set(item, PANEL_NOTIFY_STATUS, XV_ERROR, NULL);
  1548. X!           free(path);
  1549. X!           return;
  1550. X!           }
  1551. X         }
  1552. X      if ((f = fopen(path, "w")) == NULL) {
  1553. X         error("Cannot write to %s: %s", path, sys_errlist[errno]);
  1554. X!        xv_set(item, PANEL_NOTIFY_STATUS, XV_ERROR, NULL);
  1555. X!        free(path);
  1556. X         }
  1557. X!     else {
  1558. X!        kind = (int) xv_get(ip->store_type, PANEL_VALUE);
  1559. X!        if (kind & 1) {
  1560. X!           fprintf(f, "defaults {\n");
  1561. X!           fprintf(f, "   beep                 %d\n", defaults.beep);
  1562. X!           fprintf(f, "   command              \"%s\"\n", check_escapes(is_null(defaults.command)));
  1563. X!           fprintf(f, "   flash                %s\n", yes_no(defaults.flash));
  1564. X!           fprintf(f, "   open                 %s\n", yes_no(defaults.open));
  1565. X!           fprintf(f, "   stamp                %s\n", yes_no(defaults.stamp));
  1566. X!           fprintf(f, "   good_icon            \"%s\"\n", is_null(defaults.good_icon));
  1567. X!           fprintf(f, "   check_icon           \"%s\"\n", is_null(defaults.bad_icon));
  1568. X!           fprintf(f, "   flash_icon           \"%s\"\n", is_null(defaults.flash_icon));
  1569. X!           fprintf(f, "   print                \"%s\"\n", defaults.print_filter);
  1570. X!           fprintf(f, "   log_file             \"%s\"\n", is_null(defaults.log_file));
  1571. X!           fprintf(f, "   log_before_filtering %s\n", yes_no(!defaults.log_after));
  1572. X!           fprintf(f, "   timestamp            %d\n", defaults.stamp_resolution);
  1573. X!           fprintf(f, "   display              %d\n", defaults.max_size);
  1574. X!           fprintf(f, "   delete               %d\n", defaults.delete_amount);
  1575. X!           fprintf(f, "}\n");
  1576. X!           }
  1577. X!        if (kind & 2) {
  1578. X!           fprintf(f, "filters {\n");
  1579. X!           for (filt = filters; filt; filt = filt->next) {
  1580. X!              fprintf(f, "   {\n");
  1581. X!              fprintf(f, "      match   \"%s\"\n", check_escapes(filt->start));
  1582. X!              if (filt->stop)
  1583. X!                 fprintf(f, "      to      \"%s\"\n", check_escapes(filt->stop));
  1584. X!              if (filt->comment)
  1585. X!                 fprintf(f, "      comment \"%s\"\n", check_escapes(filt->comment));
  1586. X!              if (filt->save) {
  1587. X!                 fprintf(f, "      ignore  no\n");
  1588. X!                 fprintf(f, "      beep    %d\n", filt->beep);
  1589. X!                 fprintf(f, "      command \"%s\"\n", check_escapes(is_null(filt->command)));
  1590. X!                 fprintf(f, "      flash   %s\n", yes_no(filt->flash));
  1591. X!                 fprintf(f, "      open    %s\n", yes_no(filt->open));
  1592. X!                 fprintf(f, "      stamp   %s\n", yes_no(filt->stamp));
  1593. X!                 }
  1594. X!              else
  1595. X!                 fprintf(f, "      ignore  yes\n");
  1596. X!              fprintf(f, "   }\n");
  1597. X               }
  1598. X!           fprintf(f, "}\n");
  1599. X            }
  1600. X!        fclose(f);
  1601. X         filter_file = path;
  1602. X         }
  1603. X  }
  1604. X--- 70,168 ----
  1605. X  }
  1606. X  
  1607. X  /************************************************************************/
  1608. X! EXPORT    int    store_filters_to_file(path, save_filters, save_props)
  1609. X  
  1610. X! char        *path;
  1611. X! int        save_filters;
  1612. X! int        save_props;
  1613. X  
  1614. X! {    char    buf[1024];
  1615. X!     int    answer;
  1616. X      FILE    *f;
  1617. X      Filter    *filt;
  1618. X  
  1619. X      if (access(path, W_OK) == 0) {
  1620. X         sprintf(buf, "File \"%s\" exists.  You can:", path);
  1621. X!        answer = notice_prompt(contool_base->base, NULL,
  1622. X!                         NOTICE_MESSAGE_STRINGS, buf, NULL,
  1623. X!                         NOTICE_BUTTON_YES, "Overwrite",
  1624. X!                         NOTICE_BUTTON_NO, "Cancel",
  1625. X!                      NULL);
  1626. X!        if (answer == 0)
  1627. X!           return(FALSE);
  1628. X         }
  1629. X      if ((f = fopen(path, "w")) == NULL) {
  1630. X         error("Cannot write to %s: %s", path, sys_errlist[errno]);
  1631. X!        return(FALSE);
  1632. X         }
  1633. X!     fprintf(f, "version %d\n", FILTER_VERSION);
  1634. X!     if (save_props) {
  1635. X!        fprintf(f, "defaults {\n");
  1636. X!        fprintf(f, "   beep                 %d\n", defaults.beep);
  1637. X!        fprintf(f, "   command              \"%s\"\n", check_escapes(is_null(defaults.command)));
  1638. X!        fprintf(f, "   flash                %s\n", yes_no(defaults.flash));
  1639. X!        fprintf(f, "   log                  %s\n", yes_no(defaults.log));
  1640. X!        fprintf(f, "   open                 %s\n", yes_no(defaults.open));
  1641. X!        fprintf(f, "   stamp                %s\n", yes_no(defaults.stamp));
  1642. X!        fprintf(f, "   good_icon            \"%s\"\n", is_null(defaults.good_icon));
  1643. X!        fprintf(f, "   check_icon           \"%s\"\n", is_null(defaults.bad_icon));
  1644. X!        fprintf(f, "   flash_icon           \"%s\"\n", is_null(defaults.flash_icon));
  1645. X!        fprintf(f, "   print                \"%s\"\n", defaults.print_filter);
  1646. X!        fprintf(f, "   log_file             \"%s\"\n", is_null(defaults.log_file));
  1647. X!        fprintf(f, "   log_before_filtering %s\n", yes_no(!defaults.log_after));
  1648. X!        fprintf(f, "   timestamp            %d\n", defaults.stamp_resolution);
  1649. X!        fprintf(f, "   display              %d\n", defaults.max_size);
  1650. X!        fprintf(f, "   delete               %d\n", defaults.delete_amount);
  1651. X!        fprintf(f, "}\n");
  1652. X!        }
  1653. X!     if (save_filters) {
  1654. X!        fprintf(f, "filters {\n");
  1655. X!        for (filt = filters; filt; filt = filt->next) {
  1656. X!           fprintf(f, "   {\n");
  1657. X!           fprintf(f, "      match   \"%s\"\n", check_escapes(filt->start));
  1658. X!           if (filt->stop) {
  1659. X!              fprintf(f, "      to      \"%s\"\n", check_escapes(filt->stop));
  1660. X!              fprintf(f, "      timeout %d\n", filt->timeout);
  1661. X               }
  1662. X!           if (filt->comment)
  1663. X!              fprintf(f, "      comment \"%s\"\n", check_escapes(filt->comment));
  1664. X!           if (filt->save) {
  1665. X!              fprintf(f, "      ignore  no\n");
  1666. X!              fprintf(f, "      beep    %d\n", filt->beep);
  1667. X!              fprintf(f, "      command \"%s\"\n", check_escapes(is_null(filt->command)));
  1668. X!              fprintf(f, "      flash   %s\n", yes_no(filt->flash));
  1669. X!              fprintf(f, "      log     %s\n", yes_no(filt->log));
  1670. X!              fprintf(f, "      open    %s\n", yes_no(filt->open));
  1671. X!              fprintf(f, "      stamp   %s\n", yes_no(filt->stamp));
  1672. X!              }
  1673. X!           else
  1674. X!              fprintf(f, "      ignore  yes\n");
  1675. X!           fprintf(f, "   }\n");
  1676. X            }
  1677. X!        fprintf(f, "}\n");
  1678. X!        }
  1679. X!     fclose(f);
  1680. X!     return(TRUE);
  1681. X! }
  1682. X! 
  1683. X! /************************************************************************/
  1684. X! EXPORT    void    store_filters(item, event)
  1685. X! 
  1686. X! Panel_item    item;
  1687. X! Event        *event;
  1688. X! 
  1689. X! {    contool_store_objects    *ip = (contool_store_objects *) xv_get(item, XV_KEY_DATA, INSTANCE);
  1690. X!     char    *path;
  1691. X!     int    kind;
  1692. X! 
  1693. X!     path = expand_tilde(xv_get(ip->store_file, PANEL_VALUE));
  1694. X!     kind = (int) xv_get(ip->store_type, PANEL_VALUE);
  1695. X!     if (store_filters_to_file(path, kind & 2, kind & 1)) {
  1696. X!        xv_set(item, PANEL_NOTIFY_STATUS, XV_OK, NULL);
  1697. X         filter_file = path;
  1698. X+        }
  1699. X+     else {
  1700. X+        free(path);
  1701. X+        xv_set(item, PANEL_NOTIFY_STATUS, XV_ERROR, NULL);
  1702. X         }
  1703. X  }
  1704. END_OF_FILE
  1705. if test 55243 -ne `wc -c <'patch.2'`; then
  1706.     echo shar: \"'patch.2'\" unpacked with wrong size!
  1707. fi
  1708. # end of 'patch.2'
  1709. fi
  1710. echo shar: End of shell archive.
  1711. exit 0
  1712.  
  1713. --
  1714. Dan Heller
  1715. O'Reilly && Associates       Z-Code Software    Comp-sources-x:
  1716. Senior Writer                President          comp-sources-x@uunet.uu.net
  1717. argv@ora.com                 argv@zipcode.com
  1718.